<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/baselogin.css" />
		<!-- 新 Bootstrap 核心 CSS 文件 -->
		<link rel="stylesheet" href="css/bootstrap.min.css">
		<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			$(document).ready(function() {
				//添加checkbox勾选事件
				$('#check_protocol').click(function() {
					check_submit_isable();
				});

				//判断注册协议checkbox是否被选中，只要有选中，就让注册按钮可用并增加样式	
				function check_submit_isable() {
					var btn = $('button.btn_reg');
					if($('input#check_protocol').is(':checked') == true) {
						btn.prop('disabled', false);
						btn.toggleClass("btn-danger", true);
						//btn.addClass("action-settle");
					} else {
						btn.prop('disabled', true);
						btn.toggleClass("btn-danger", false);
					}
				}

				//验证输入不能为空
				function checkInputIsNotNull(input, message) {
					if(input.val() == null || input.val() === undefined || input.val().trim() == "") {
						//alert(message);
						var err='<span style="color:#FF0000;font-size:12px;">*'+message+'</span>';
						input.next().remove();
						input.after(err); //添加星号
						input.val(''); //默认清空
						return false;
					} else {
						input.next().remove();//移除星号
						return true;
					}
				}
                
                //提交验证表单
				$('button.btn_reg').click(function() {
					var rtn = [];
					var username = $('input#username');
					var password = $('input#password');
					var repassword = $('input#repassword');
					var mobile = $('input#mobile_phone');
					var validatecode = $('input#valcode');

					rtn[0] = checkInputIsNotNull(username, '用户名不能为空');
					rtn[1] = checkInputIsNotNull(password, '密码不能为空');
					rtn[2] = checkInputIsNotNull(repassword, '重复密码不能为空');
					rtn[3] = checkInputIsNotNull(mobile, '手机号不能为空');
					rtn[4] = checkInputIsNotNull(validatecode, '验证码不能为空');
					
					for(i=0;i<rtn.length;i++){
						if(rtn[i]==false){
							return rtn[i];
						}
					}					
					return true;
				});

				check_submit_isable();
			});
		</script>
	</head>

	<body>
		<div id="header" class="head_block clearfix">
			<div class="head_logo">
				<img src="img/logo.png" />
			</div>
			<div class="signheader_img">
				<img src="img/signheader_img.png" />
			</div>
		</div>
		<div id="content" style="min-width: 1100px;height: 550px;" class="clearfix">
			<div class="reg_content" class="clearfix">
				<div class="reg-signin">
					<div class="reg_title clearfix">
						<h2>注册会员</h2>
						<div class="register_link">
							已是会员？
							<a href="/login">
								立即登录
							</a>
						</div>
					</div>
					<div class="reg_form">
						<form action="/regMember" method="post">
							<ul>
								<li class="form_item">
									<label class="form_lable">用户名：</label>
									<input type="text" class="x-input" id="username" name="username" value="" />
								</li>

								<li class="form_item">
									<label class="form_lable">手机号：</label>
									<input type="text" class="x-input" id="mobile_phone" name="mobile_phone" value="" /></li>
								<li class="form_item">
									<label class="form_lable">密码：</label >
									<input type="password" class="x-input" id="password" name="password" value="" /></li>
								<li class="form_item">
									<label class="form_lable">重复密码：</label>
									<input type="password" class="x-input" id="repassword" name="repassword" value="" /></li>
								<li class="form_item">
									<label class="form_lable">验证码：</label>
									<img id="validatecode" class="fl" onclick="this.src='/code?rd='+Math.random();" src="/code" title="点击刷新">
									<input type="text" class="v-input" id="valcode" name="valcode" value="" />
									<!--<a onclick="document.getElementById('validatecode').src='/code?d='+Math.random();">换一张?</a>-->
								</li>
								<li class="form_item" style="font-size: 13px;">
									<label class="form_lable"></label>
									<input type="checkbox" id="check_protocol" value="" />我已阅读并同意 一帆服务协议 和 隐私保护政策</li>
								<li class="form_item">
									<label class="form_lable"></label>
									<button type="submit" class="btn btn_reg btn_enable">注册会员</button></li>
							</ul>
						</form>
					</div>
					<div style="height: 20px;">

					</div>
				</div>
				<div class="reg-img">
					<img src="img/regbg_img.png" />
				</div>
			</div>
		</div>
		<div id="footer" class="footer_sign">
			<div class="ft_nav">
				<a href="#">关于我们</a> |
				<a href="#">关于我们</a> |
				<a href="#">关于我们</a>
			</div>
			<div class="ft_copyright">
				Copyright ©2013-2016 xxxx.com. All Rights Reserved
			</div>
		</div>
	</body>

</html>